package com.yc.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yc.entity.User;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 * InnoDB free: 4096 kB Mapper 接口
 * </p>
 *
 * @author ly
 * @since 2022-05-25
 */
public interface UserMapper extends BaseMapper< User > {
    @Select("select * from user")
    public List<User> queryAll();

    @Update("UPDATE user SET ustate=#{ustate} where uid=#{uid}")
    public Integer freeze(Integer uid,String ustate);

    @Update("update user set email=#{email} where ucount=#{ucount}")
    public Integer removemail(String email,String ucount);

    @Update("update user set password=#{password} where ucount=#{ucount}")
    public Integer modifypass(String password,String ucount);

    /**
     * 更新登录次数
     * @param loginednum
     * @param ucount
     * @return
     */
    @Update("update user set loginednum=#{loginednum} where ucount=#{ucount}")
    public Integer updateloginednum(int loginednum, String ucount);

    /**
     *更新登录时间
     * @param lastlogineddate
     * @param curlogindate
     * @param ucount
     * @return
     */
    @Update("update user set lastlogineddate=#{lastlogineddate} , curlogindate=#{curlogindate} where ucount=#{ucount}")
    public Integer updatelastlogineddate(String lastlogineddate,String curlogindate, String ucount);
}
